package io.geekidea.springboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.geekidea.springboot.entity.Device;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface DeviceMapper extends BaseMapper<Device> {

    Device selectDeivcegWithBuildId(Long id);

    List<Device> selectDevicesWithBuild(Long buildingId, Integer page, Integer size);

    @Select("SELECT COUNT(*) FROM SYSDBA.DEVICE WHERE BUILDING_ID = #{buildId}")
    int countByBuildId(@Param("buildId") Long buildId);
}
